

from playwright.sync_api import sync_playwright


with sync_playwright() as p:
    browser = p.chromium.launch(headless=False)
    page = browser.new_page()
    page.goto('https://www.baidu.com')
    page.wait_for_timeout(2000)
    page.screenshot(path='./baidu.png')
    page.locator('#su').screenshot(path='./su.png')


    page.wait_for_timeout(2000)

